import java.util.Scanner;

public class Hanoi {
    public  static void move(char a,char c){
        System.out.println(a+"->"+c);
    }
    public static void hanoi(int n,char a,char b,char c){
        if(n==1){
            move(a,c);
        }else{
            hanoi(n-1,a,c,b);//将a上的n-1个盘子借助c移动到b柱上
            move(a,c);
            hanoi(n-1,b,a,c);

        }
    }
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        hanoi(n,'A','B','C');

    }
}
